DR='N:'
F1='PATIENT'
SELE 1
USE &DR&F1
STORE SPAC(4) to pat
pat='0000'
STORE 0 TO MYCOUNT

GO TOP

        DO WHILE !EOF()
*          DO WHILE MYCOUNT < 50
 *               MYCOUNT = MYCOUNT + 1

          *      @10,10 SAY PAT_FILCOD+' : BEFORE -->    '+PAT_CODCRP+'      '+JOB_CRPCOD

                IF JOB_CRPCOD=' '
                        REPL JOB_CRPCOD with pat
       *                 @16,10 SAY PAT_FILCOD+' BLANK JOB CORP '
        *        ELSE                        
         *               @16,10 SAY '                              '  
                ENDIF

                IF PAT_CODCRP=' '
                        REPL PAT_CODCRP WITH pat
      *                  @17,10 SAY PAT_FILCOD+' BLANK PATIENT COD '
     *           ELSE
    *                    @17,10 SAY '                              '  
                ENDIF

                IF JOB_CRPCOD<>'0000' 
                        REPL PAT_CODCRP WITH JOB_CRPCOD
   *                     @18,10 SAY PAT_FILCOD+' REPLACE WITH JOB CORP ' 
                ELSE
                        IF PAT_CODCRP<>'0000'
                                REPL JOB_CRPCOD WITH PAT_CODCRP
  *                              @18,10 SAY PAT_FILCOD+' REPLACE WITH << PATIENT >> '
*                        ELSE
*                                @18,10 SAY PAT_FILCOD+' UNKNOWN '                                
                        ENDIF
                ENDIF
 *               @20,10 SAY '[AFTER]  ' + PAT_FILCOD+'     '+PAT_CODCRP+'      '+JOB_CRPCOD
*                WAIT ' '
                SKIP
        ENDDO

